package com.zju.cst.cloudApp.util;

import com.thoughtworks.xstream.XStream;
import com.zju.cst.cloudApp.entity.Message;

public class XmlUtil {

	private static XStream xstream;

	//config Xml
	static {
		xstream = new XStream();
		xstream.alias("mesage", Message.class);
	}

	public static String obj2Xml(Object object) {
		String xml = xstream.toXML(object);
		return xml;
	}
	
	public static Object xml2Obj(String xml) {
		Object obj = xstream.fromXML(xml);
		return obj;
	}
	
}
